<template>
  <section>
    <span>{{widget.description}}</span>
    <el-dialog title="配置小部件默认信息"
               :visible.sync="showConfDialog">
      <el-form>
        <el-form-item label="咨询二维码">
          <el-input v-model="widget.config.qrcode"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="confCancel">取消</el-button>
        <el-button type="primary" @click="confDone">确定</el-button>
      </span>
    </el-dialog>
  </section>
</template>

<script>
  export default {
    name: "fangan-c",
    props: ['widget', 'showConfDialog'],
    created(){
      if(this.widget.data){
        this.widget.data=null
        this.$emit('save',this.widget)
        return
      }
      if(!this.widget.config){
        this.widget.config = {}
      }
      if(!this.widget.config.qrcode)
        this.widget.config.qrcode=''
    },
    methods:{
      confCancel(e){
        this.$emit('done',null)
      },
      confDone(e){
        this.$emit('done',this.widget)
      }
    }
  }
</script>

<style scoped>

</style>
